package com.shard2.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author: LCG
 * 作者: LCG
 * 日期: 2021/4/1  18:16
 * 描述:
 */
@Mapper
@Repository
public interface TestShardMapper {

    @Insert("insert into tb_order(id,userId,orderName,createTime)values(#{id},#{userId},#{orderName},NOW())")
    public int addOne(Map<String,Object> map);

    @Insert("insert into tb_order_item(id,userId,itemName,orderId)values(#{id},#{userId},#{itemName},#{orderId})")
    public int addItems(Map<String,Object> map);


    @Select("select tod.orderName,toi.itemName from tb_order tod inner join tb_order_item toi on tod.id=toi.orderId")
    public List<Map<String,Object>> getOrderItemList();

    @Select("select * from tb_order where orderName like CONCAT('%',#{orderName},'%')")
    public List<Map<String,Object>> getOrderList(String orderName);




}
